<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/tags.jsp"%>
<%
	String path = request.getContextPath();	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>增加用户</title>
<%@ include file="/WEB-INF/jsp/common/ui.jsp"%>
</head>
<body>
	<div id="dd" class="easyui-draggable easyui-resizable"
		data-options="handle:'#mymailform'"
		style="width: 500px; height: 280px; border: 1px solid #ccc">
		<div style="padding: 5px; width: 500px" id="mymailform">拖动</div>
		<div class="easyui-panel" title="" style="width: 500px">
			<div style="padding: 10px 0 10px 60px">

				<form:form  method="post" commandName="user"
					id="mailForm" target="mailiframe">
					<table>
						<tr>
							<form:hidden path="id"/>
							<td>用户名:</td>
							<td>
							<form:input path="name" class="easyui-validatebox" data-options="required:true" />
							</td>
						</tr>
						<tr>
							<td>帐号:</td>
							<td>
							<form:input path="account" class="easyui-validatebox" data-options="required:true"/>
							</td>
						</tr>
						<tr>
							<td>邮箱:</td>
							<td>
							<form:input path="email" class="easyui-validatebox" data-options="required:true,validType:'email'"/>
							</td>
						</tr>
						<tr>
							<td>登录密码:</td>
							<td>
							<input class="easyui-validatebox" type="password"
								name="password" id="pwd" ></td>
						</tr>
						<tr>
						<td>确认登录密码:</td>
						<td><input type="password" name="repassword" id="repassword" 	 class="easyui-validatebox"
								validType="equalTo['#pwd']" invalidMessage="两次输入密码不匹配" /></td>
						</tr>
						

						<tr>
							<td colspan="2">
								<form:button type="submit"  class="easyui-linkbutton" >保存</form:button>
								<form:button type="reset">清除数据</form:button>
						</tr>
					</table>
				</form:form>
				<form:errors />
			</div>
			<div style="text-align: center; padding: 5px"></div>
		</div>
	</div>


	<script type="text/javascript">
		/**
		 * @author 
		 */
		$.extend($.fn.validatebox.defaults.rules, {
			/*必须和某个字段相等*/
			equalTo : {
				validator : function(value, param) {
					return $(param[0]).val() == value;
				},
				message : '字段不匹配'
			}

		});

		$(function() {

			$('#mailForm').form({
				url : '<%=path%>/user/save',
				onSubmit : function() {
					return $(this).form('validate');
				},
				success : function(data) {
					$.messager.alert("操作提示", data);

				}
			});
		});

		function clearForm() {
			$('#mailForm').form('clear');
		}
	</script>
</body>
</html>